package com.example.uilearning;

import android.app.LauncherActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class LaunchActivity extends LauncherActivity {

	// 要启动的activity的名字
	String[] names = { "设置程序参数", "查看星际兵种" };

	// 定义两个对应的实现类
	Class<?>[] clasz = { PreferenceActivityTest.class,
			ExpandableListActivityTest.class };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, names);
		setListAdapter(adapter);
	}

	// 根据列表返回制定的Activity的Intent

	@Override
	protected Intent intentForPosition(int position) {
		return new Intent(LaunchActivity.this, clasz[position]);
	}

}
